package com.iflysse.common;

public enum ResultEnum {
    //通用
    SUCCESS(1000, "操作成功"),
    NOPARAMETER(1001, "参数有误"),
    ERROR(1002, "服务器异常，请稍后再试"),

//    登录
    CODEERROR(1003,"验证码有误"),
    ACCOUNTERROR(1004,"账号或密码有误"),
    NOTOKEN(1005,"token信息为空"),
    TOKENERROR(1006,"token信息有误"),

//创建班级
    NOTSUCCESS(1007,"创建失败"),

    NOTHAVECOURSE(1008,"没有课程"),

    TYPEFILEERROR(1009,"不是文件上传，表单必须包含enctype=multipart/form-data"),
    HASEXISTED(1010,"已经存在"),

    LINKISERROR(1011,"链接已到期，请重新获取"),
    ERRORPASSWORD(1012,"密码不一致"),
    LABELNOTUPDATE(1013,"该标签已被课程绑定，无法删除或修改"),
    UNDEFINE(-1, "未定义异常信息");
    private int code;
    private String msg;
    ResultEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public static String msg(int code) {
        for (ResultEnum m : ResultEnum.values()) {
            if (m.getCode() == code) {
                return m.getMsg();
            }
        }
        return UNDEFINE.getMsg();
    }
    public int getCode() {
        return code;
    }
    public void setCode(int code) {
        this.code = code;
    }
    public String getMsg() {
        return msg;
    }
    public void setMsg(String msg) {
        this.msg = msg;
    }

}
